# 使用官方Python镜像作为基础镜像
FROM python:3.9

# 设置工作目录
WORKDIR /app

# 安装系统依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc \
    libmariadb-dev \
    && rm -rf /var/lib/apt/lists/*

# 复制requirements.txt文件
COPY ./student/requirements.txt /app/

# 复制jeager模块的requirements.txt
COPY ./jeager/requirements.txt /app/jeager_requirements.txt

# 复制Prothemeus模块的requirements.txt
COPY ./Prothemeus/requirements.txt /app/prothemeus_requirements.txt

# 复制eureka_client模块的requirements.txt
COPY ./eureka_client/requirements.txt /app/eureka_requirements.txt

# 安装所有依赖项
RUN pip install --no-cache-dir -r requirements.txt \
    -r jeager_requirements.txt \
    -r prothemeus_requirements.txt \
    -r eureka_requirements.txt

# 复制所有应用代码
COPY . /app/

# 设置环境变量
ENV PYTHONPATH=/app
ENV HOST=0.0.0.0
ENV PORT=8002

# 暴露端口
EXPOSE 8002

# 启动命令
CMD ["python", "-m", "uvicorn", "student.main:app", "--host", "0.0.0.0", "--port", "8002"]